import http from "./request";

// 登陆
export const adminLogin = (params: IparamsLogios): RES<ILoginResult> =>
  http.post("/admin/login", params);
// 登陆后获得用户信息
export const adminInfo = (): RES<ILoginInfoResult> => http.get("/admin/info");

// 根据用户名或姓名分页获取用户列表;
export const adminList = (params: IadminListParams): RES<IAdminListModal> =>
  http.get("/admin/list", { params: params });

// 用户注册
export const adminRegister = (
  params: IadminRegisterParams
): RES<IadminRegisterModal> => http.post("/admin/register", params);

// 根据id请求用户信息;
export const getAdmininofId = (id: number): RES<IListModal> =>
  http.get(`/admin/${id}`);

// 修改指定用户信息
export const updataAdmininfo = (params: IadminRegisterModal): RES<any> =>
  http.post(`/admin/update/${params.id}`, params);

// 修改帐号状态 是否开启
export const updateStatus = (id: number, status: number): RES<any> =>
  http.post(`/admin/updateStatus/${id}?status=${status}`);

// 获取指定用户的角色
export const getAdminbjId = (id: number): RES<IListModal> =>
  http.get(`/admin/role/${id}`);
